Skip to content

Changed the minimum count of dummy data (folders and notes)#1649

Merged
Rokt33r merged 2 commits intoBoostIO:masterfrom
rayou:fix-1562-change-dummy-data-minimum-count
Mar 9, 2018
Merged

Changed the minimum count of dummy data (folders and notes)#1649
Rokt33r merged 2 commits intoBoostIO:masterfrom
rayou:fix-1562-change-dummy-data-minimum-count

Conversation

@rayou
Copy link
Contributor

@rayou rayou commented Mar 9, 2018

Fix #1562

At least two dummy folders/notes are required for reordering folders and moving notes in the test. Current dummy data implementation might result in generate only one folder / note.

Please see code below.

TestDummy.js

var folderCount = Math.floor((Math.random() * 5)) + 1
/* ... */
var noteCount = Math.floor((Math.random() * 15)) + 1

However, following tests access to the second item in the folders/notes array.

reorderFolder-test.js

  const secondFolderKey = t.context.storage.json.folders[1].key

moveNote-test.js

  const note2 = t.context.storage1.notes[1]

Increased the minimum count to 2 resolve the issue.

@Rokt33r
Copy link
Member

Rokt33r commented Mar 9, 2018

Wow, I didn't notice there are usages of Math.random. I think this is a bad practice when testing. We should pull out them somewhen.

Anyway, great work!

@Rokt33r Rokt33r merged commit 1226267 into BoostIO:master Mar 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix test

2 participants